import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../layout/layout'

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        name: 'home',
        redirect: '/home',
        component: Layout,
        children: [{
            path: 'home',
            component: require('@/views/workbench/index').default
        }]
    },
    {
        path: '/login',
        name: 'login',
        component: require('@/views/login/login').default
    },
    {
        path: '/q&a',
        name: 'q&a',
        redirect: '/q&a/index',
        component: Layout,
        children: [{
            path: 'index',
            component: require('@/views/q&a/index').default
        }]
    },
    {
        path: '/setting',
        name: 'setting',
        redirect: '/setting/index',
        component: Layout,
        children: [{
            path: 'index',
            component: require('@/views/setting/setting').default
        }, {
            path: 'operation-record',
            component: require('@/views/setting/operation-record').default
        }, {
            path: 'declare',
            component: require('@/views/setting/declare').default
        }, {
            path: 'password',
            component: require('@/views/setting/password').default
        }]
    },
    {
        path: '/output',
        name: 'output',
        redirect: '/output/enter-code',
        component: Layout,
        children: [{
            path: 'enter-code',
            component: require('@/views/output/enter-code').default
        },{
            path: 'scan',
            component: require('@/views/output/scan').default
        }]
    }
];

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router
